home *** CD-ROM | disk | FTP | other *** search
/ Software USA 4 #11 / Software USA Volume 4.11.iso / mac / Educational / mac06 / usr / include / stdio.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-05-21  |  2.8 KB  |  99 lines  |  [TEXT/SPM ]

  1. /* mac06©1997,98 by HNS/DSITRI hns@computer.org
  2. ** stdio.h
  3. **
  4. ** 02.01.1998    HNS        rename(), remove(), gets() corrected
  5. */
  6.  
  7. #pragma once
  8.  
  9. #include "stdarg.h"
  10. #include "limits.h"
  11. #include "size_t.h"
  12.  
  13. #define BUFSIZ            (1024)
  14. #define EOF             (-1)
  15. #define FILENAME_MAX    (256)
  16. #define FOPEN_MAX        (OPEN_MAX)
  17. #ifndef NULL
  18. #define NULL             (0)
  19. #endif
  20. #ifndef SEEK_SET
  21. #define SEEK_CUR        (1)
  22. #define SEEK_END        (2)
  23. #define SEEK_SET        (0)
  24. #endif
  25. #define TMP_MAX            26
  26. #define L_tmpnam        32
  27. #define _IOFBF            0x01
  28. #define _IOLBF            0x02
  29. #define _IONBF            0x04
  30.  
  31. typedef unsigned long fpos_t;
  32.  
  33. typedef struct
  34.     {
  35.     int fd;
  36.     unsigned char *bfr;    /* base address */
  37.     unsigned char *ptr;    /* read/write pointer */
  38.     unsigned char *end;    /* end of buffer */
  39.     int flags;
  40.     int pid;                /* for popen */
  41.     } FILE;
  42.     
  43. extern FILE *stdin;
  44. extern FILE *stdout;
  45. extern FILE *stderr;
  46.  
  47. #define clearerr(fp) ((fp)->flags&=~0x20)
  48. int fclose(FILE *fp);
  49. #define feof(fp) ((fp)->flags&0x10)
  50. #define ferror(fp) ((fp)->flags&0x20)
  51. int fflush(FILE *fp);
  52. int fgetc(FILE *f);
  53. #define fgetpos(f, pos) ((*(pos)=ftell(f)) != -1l)
  54. char *fgets(char *s, int n, FILE *fp);
  55. #define fopen(N, M) (freopen((N), (M), NULL))
  56. int fprintf(FILE *f, char *format, ...);
  57. int fputc(int c, FILE *f);
  58. #define fputs(s, fp) (fwrite((s), 1, strlen(s), (fp)))
  59. size_t fread(void *buf, size_t size, size_t nitems, FILE *fp);
  60. FILE *freopen(char *name, char *mode, FILE *fp);
  61. int fscanf(FILE *f, char *format, ...);
  62. int fseek(FILE *fp, long off, int w);
  63. #define fsetpos(f, pos) fseek((f), *(pos), SEEK_SET)
  64. long int ftell(FILE *fp);
  65. size_t fwrite(void *buf, size_t size, size_t nitems, FILE *fp);
  66. int _ffill(FILE *);
  67. #define getc(fp) ((fp)->ptr < (fp)->end?*(fp)->ptr++:_ffill(fp))
  68. #define getchar() getc(stdin)
  69. char *gets(char *s);
  70. void perror(char const *s);
  71. int pclose(FILE *f);
  72. FILE *popen(const char *cmd, const char *mod);
  73. int printf(char *format, ...);
  74. #define putc(C, fp) (*(fp)->ptr++=(C), (fp)->ptr >= (fp)->end || (C) == '\n'?(fflush(fp)<0?EOF:(C)):(C))
  75. #define putchar(C) (putc(C, stdout))
  76. #define puts(s) (fputs((s), stdout), putchar('\n'))
  77. int remove(char *name);
  78. int rename(char *from, char *to);
  79. #define rewind(fp) (fseek((fp), 0l, SEEK_SET))
  80. int scanf(char *format, ...);
  81. #define setbuf(fp, buf) setvbuf((fp), (buf), _IOFBF, BUFSIZE)
  82. #define setvbuf(fp, buf, mode, size) /* ignore */
  83. int sprintf(char *buf, char *format, ...);
  84. int sscanf(char *buf, char *format, ...);
  85. FILE *tmpfile(void);
  86. char *tmpnam(char *s);
  87. #define ungetc(c, fp) if((fp)->ptr == (fp)->bfr) *(fp)->ptr=(c), (fp)->end=(fp)->bfr+1; else *--(fp)->ptr=(c)
  88. int vprintf(char *format, va_list arg);
  89. int vfprintf(FILE *f, char *format, va_list arg);
  90. int vsprintf(char *buf, char *format, va_list arg);
  91.  
  92. #define fileno(fp) ((fp)->fd)
  93. #define fdopen(FD, M) (fdreopen((FD), (M), NULL))
  94.  
  95. #ifndef _POSIX_SOURCE
  96. FILE *fdreopen(int fd, const char *mode, FILE *fp);
  97. #endif
  98.  
  99. /* EOF */